<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="../../js/vue.js"></script>
</head>

<body>
    <div id="app">
        <select v-model="provinceList">
            <option value="">请选择省份</option>
            <option v-for="item in list" :key="item.id" :value="item.list">{{item.city}}</option>
        </select>
        <select v-model=townList>
            <option value="">请选择城市</option>
            <option v-for="item in provinceList" :key="item.id" :value="item.list">{{item.city}}</option>
        </select>
        <select>
            <option value="">请选择区县</option>
            <option v-for="item in townList" :key="item.id" :value="item.list">{{item.city}}</option>
        </select>
        
    </div>
</body>
<script>
    new Vue({
        el: "#app",
        data: {
            provinceList: "",
            townList: "",
            list: [
                {
                    id: 1, city: "湖北", list: [
                        {
                            id: 11, city: "武汉", list: [
                                {id: 111, city: "江夏"},
                                {id: 112, city: "洪山"}
                            ]
                        },
                        {
                            id: 12, city: "荆州", list: [
                                {id: 121, city: "沙市"},
                                {id: 122, city: "公安"}
                            ]
                        }
                    ]
                },
                {
                    id: 2, city: "湖南", list: [
                        {
                            id: 21, city: "长沙", list: [
                                {id: 211, city: "芙蓉"},
                                {id: 212, city: "花雨"}
                            ]
                        },
                        {
                            id: 22, city: "株洲", list: [
                                {id: 221, city: "天元"},
                                {id: 222, city: "荷塘"}
                            ]
                        }
                    ]
                },
                {
                    id: 3, city: "贵州", list: [
                        {
                            id: 31, city: "贵阳", list: [
                                {id: 311, city: "南明"},
                                {id: 312, city: "开阳"}
                            ]
                        },
                        {
                            id: 32, city: "遵义", list: [
                                {id: 321, city: "汇川"},
                                {id: 322, city: "红花"}
                            ]
                        }
                    ]
                }
            ]
        },
        methods: {
           
        },
        watch: {
            provinceList() { //省份发生改变，清空列表
                this.townList = "";
            }
        }
    })
</script>

</html>